package com.example.mtbatissource;

import com.example.mtbatissource.mybatisdemo.MyImportBeanDefinitionRegistrar;
import com.example.mtbatissource.mybatisdemo.UserMapper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@Import(MyImportBeanDefinitionRegistrar.class)
public class MtbatisSourceApplication {

    public static void main(String[] args) {
//        SpringApplication.run(MtbatisSourceApplication.class, args);

          ConfigurableApplicationContext context = new SpringApplicationBuilder(MtbatisSourceApplication.class).run(args); // 运行应用，传入命令行参数

        UserMapper bean = context.getBean(UserMapper.class);
        bean.selectUser();
        System.out.println(bean);
    }

}
